from ui.addUser import Ui_AddUserMainWindow
from service import *
from PyQt5 import QtWidgets

class AddUserMainWindow(Ui_AddUserMainWindow, QtWidgets.QMainWindow):
    def __init__(self) -> None:
        super().__init__()
        self.setupUi(self)
        self.pushButton.clicked.connect(self.addUser)

    def addUser(self):
        username = self.lineEdit.text()
        password = self.lineEdit_2.text()
        email = self.lineEdit_3.text()
        role = self.comboBox.currentText()
        us = UserService()
        us.addUser(username, password, email, role)
        self.close()